package dian.com.mvvmdemo.login

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import dian.com.mvvmdemo.http.base.BaseViewModel
import dian.com.mvvmdemo.http.base.ResponseData
import dian.com.mvvmdemo.http.databean.loginData
import dian.com.mvvmdemo.http.repository.LoginRepository


/*
 *
 *Created by QingDian_Fan on 2019/11/19
 * */
class LoginViewModel : BaseViewModel() {

    private  var data:MutableLiveData<ResponseData<loginData>> = MutableLiveData()

    private val repository = LoginRepository()

    fun getLogin(): LiveData<ResponseData<loginData>> {

        return data
    }

     fun loginDatas(name: String, pwd: String)= launchUI {
        val result = repository.loginDatas(name, pwd)
       data.postValue(result)
    }
}